Skip to content

Support higher performance bvar with babylon counter#3116

Merged
chenBright merged 2 commits into
apache:masterfrom
chenBright:babylon_bvar
Oct 26, 2025
Merged

Support higher performance bvar with babylon counter#3116
chenBright merged 2 commits into
apache:masterfrom
chenBright:babylon_bvar

Conversation

@chenBright

@chenBright chenBright commented Oct 12, 2025

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve #2675

Problem Summary:

bvar::detail::AgentCombiner use LOCK or CAS operation as a general implementation for counter, but the LOCK or CAS operation may be avoidable.

What is changed and the side effects?

Changed:

Refer to Use concurrent counter optimize bvar to use babylon counter to implement bvar and improve bvar performance.

Use bvar with babylon(>= 1.4.4) counter through bazel build --define with_babylon_counter=true //:brpc.

Side effects:

  • Performance effects:

Performance report from Use concurrent counter optimize bvar:

AMD EPYC 7W83 64-Core Processor bvar babylon bvar
adder 12.51 ns 7.68 ns
maxer 12.53 ns 8.21 ns
int_recorder 15.48 ns 9.82 ns
latency_recorder 132.36 ns 28.66 ns
  • Breaking backward compatibility:

Check List:

@chenBright

chenBright commented Oct 12, 2025

Copy link
Copy Markdown
Contributor Author

CC @oathdruid @wwbmmm

@wwbmmm

wwbmmm commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

I think you can also update the document for this new feature.

@wwbmmm wwbmmm requested a review from Copilot October 13, 2025 02:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements optional integration with Babylon counter library to improve bvar performance through high-performance, lock-free concurrent counters. When enabled with build flag --define with_babylon_counter=true, bvar operations can achieve significant performance improvements (e.g., latency_recorder improves from 132.36ns to 28.66ns).

  • Adds conditional compilation support for Babylon counter integration throughout bvar components
  • Updates test cases to handle behavior differences when using Babylon counters
  • Modifies build configuration to support the new compilation option

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/bvar/reducer.h Implements BabylonVariable template and specializations for Adder, Maxer, Miner using Babylon counters
src/bvar/recorder.h Adds Babylon counter-based IntRecorder implementation
src/bvar/detail/percentile.h Implements Babylon counter-based Percentile class
src/bvar/detail/percentile.cpp Adds Babylon counter-specific implementation for percentile operations
test/*.cpp Updates test cases with conditional compilation for Babylon counter compatibility
BUILD.bazel Adds build configuration and dependencies for Babylon counter support
.bazelrc Updates build configuration with optimization flags

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/bvar/reducer.h Outdated
@apache apache deleted a comment from Copilot AI Oct 22, 2025
@apache apache deleted a comment from Copilot AI Oct 22, 2025
@apache apache deleted a comment from Copilot AI Oct 22, 2025
@apache apache deleted a comment from Copilot AI Oct 22, 2025
@apache apache deleted a comment from Copilot AI Oct 22, 2025
@apache apache deleted a comment from Copilot AI Oct 22, 2025
@chenBright

Copy link
Copy Markdown
Contributor Author

I think you can also update the document for this new feature.

done

@wwbmmm

wwbmmm commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

LGTM

@chenBright chenBright merged commit 1d3bded into apache:master Oct 26, 2025
17 checks passed
@chenBright chenBright deleted the babylon_bvar branch October 26, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove LOCK and CAS in bvar counter

3 participants